<style>
    .login-section .logon-tab > a{
        width: 100%;
        background-color: #ffffff;
    }
</style>
<div id="content-container" class="container">
    <div class="user-section login-section">
        <div class="login-main">
            <form name="form1" id="register-form" class="form-vertical" method="POST" action="">
                <input type="hidden" name="invite_user_id" value="0" />
                <input type="hidden" name="url" value="{$url}" />
                {:token()}

                <!--<div class="logon-tab clearfix"> <a>商家名:{$company_info.name}</a> </div>-->

                <div class="form-group">
                    <label class="control-label">{:__('Mobile')}</label>
                    <div class="controls">
                        <input type="text" id="mobile" name="mobile" data-rule="required;mobile" class="form-control input-lg" placeholder="{:__('Mobile')}">
                        <p class="help-block"></p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label">{:__('Captcha')}</label>
                    <div class="controls">
                        <div class="input-group input-group-lg">
                            <input type="text" name="captcha" class="form-control" placeholder="{:__('Captcha')}" data-rule="required;length(6)" style="border-radius: 0;" />
                            <span class="input-group-addon" style="padding:0;border:none;">
                                <span class="btn btn-small get-code" onclick="getCode(this)" id="J_getCode">获取验证码</span>
                                <span class="btn btn-small reset-code" id="J_resetCode" style="display:none;"><span id="J_second">60</span>秒后重发</span>
                            </span>
                        </div>
                        <p class="help-block"></p>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label">{:__('Password')}</label>
                    <div class="controls">
                        <input type="password" id="password" name="password" data-rule="required;password" class="form-control input-lg" placeholder="{:__('Password must be 6 to 30 characters')}">
                        <p class="help-block"></p>
                    </div>
                </div>

                <div class="form-group">
                    <input type="hidden" value="{$companyid}" name="company_id"  class="form-control input-lg" >
                    <button type="submit" class="btn btn-primary btn-lg btn-block">{:__('Sign up')}</button>
                </div>
            </form>
        </div>
    </div>
</div>

<script type="application/javascript">
/*获取验证码*/
var isPhone = 1;

function getCode(e) {
    checkPhone(); //验证手机号码
    if (isPhone) {
        resetCode(); //倒计时
    } else {
        $('#phone').focus();
    }
}
//验证手机号码
function checkPhone() {
    var phone = $('#mobile').val();
    var pattern = /^1[0-9]{10}$/;
    isPhone = 1;
    if (phone == '') {
        alert('请输入手机号码');
        isPhone = 0;
        return;
    }
    if (!pattern.test(phone)) {
        alert('请输入正确的手机号码');
        isPhone = 0;
        return;
    }
    //发送验证码
    var url = '/index/user/sendcode';
    $.post(url,{mobile:phone},function(result){
        console.log(result);
        Layer.msg(  result );
    });
}
//倒计时
function resetCode() {
    $('#J_getCode').hide();
    $('#J_second').html('60');
    $('#J_resetCode').show();
    var second = 60;
    var timer = null;
    timer = setInterval(function() {
        second -= 1;
        if (second > 0) {
            $('#J_second').html(second);
        } else {
            clearInterval(timer);
            $('#J_getCode').show();
            $('#J_resetCode').hide();
        }
    }, 1000);
}
</script>